# $Id: PKGBUILD 173851 2012-12-25 00:34:54Z foutrelis $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: Judd Vinet <jvinet@zeroflux.org>

pkgname=tk
pkgver=8.6.0
pkgrel=1
pkgdesc="A windowing toolkit for use with tcl"
arch=('i686' 'x86_64')
url="http://tcl.sourceforge.net/"
license=('custom')
depends=("tcl=${pkgver}" 'libxss' 'libxft')
source=(http://downloads.sourceforge.net/sourceforge/tcl/tk${pkgver}-src.tar.gz)
md5sums=('b883a1a3c489c17413fb602a94bf54e8')

build() {
  cd ${srcdir}/tk${pkgver}/unix

  [[ $CARCH == "x86_64" ]] && BIT="--enable-64bit"
  ./configure --prefix=/usr --mandir=/usr/share/man --enable-threads $BIT
  
  make
}

#check() {
#  cd ${srcdir}/tk${pkgver}/unix
#  make test
#}

package() {
  cd ${srcdir}/tk${pkgver}/unix

  make INSTALL_ROOT=${pkgdir} install install-private-headers
  ln -sf wish8.6 ${pkgdir}/usr/bin/wish

  # install license
  install -Dm644 license.terms ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE

  # remove buildroot traces
  sed -i "s#${srcdir}#/usr/src#" ${pkgdir}/usr/lib/tkConfig.sh

}
